<?php

//print_r($_POST);
 
// username and password sent from form 
$result=array();
$start = microtime(true);
$result['start']=$start;

if(!isset($_POST['id'])){
$result['stat']=0;
	$result['num']=0;
	
}else{
	$id=$_POST['id'];
	$sql="SELECT COUNT( * ) as count FROM  `message` WHERE  `to` =  '$id' AND  `read` =  '0'";
	$sqlresult = mysql_query( $sql ) or die( mysql_error() );
		$row = mysql_fetch_array($sqlresult);
		$result['num']=$row['count'];
	$result['stat']=1;
}
	
	  echo json_encode($result);
	  return;




?>